- content_for(:title) do
  | 编辑项目

.project-edit ng-controller="ProjectEditController" ng-init="init(#{@project.id})"
  .row
    .small-12.columns
      .tips
        p 你需要继续完善你的项目, 然后发布你的融资需求
        ul
          li 请尽可能多的完善产品截图, 及运营数据
          li 
            | 然后你可以发布 
            br
            = link_to '融资需求', admin_money_requires_path(project_id: @project.id)
            br
            = link_to '商业方案', plan_edit_projects_path(project_id: @project.id)
            br
            = link_to '运营信息', calendar_edit_projects_path(project_id: @project.id)
  .row.head-edit.ng-cloak ng-hide='head_edited'
    .small-6.large-2.columns.logo
      img ng-src='{{ project.logo_url }}'
    .small-6.large-10.columns
      .name-area
        h4.name
          a ng-href='{{ project.url }}'
            | {{ project.name }}
        p.sub-name
          | {{ project.oneword}}
        .info
          .link ng-show='project.link'
            i.fa.fa-link
            span
              a ng-href=" http://{{ project.link }}" target='_blank' {{ project.link }}
          .address
            i.fa.fa-map-marker
            span
              | {{ project.city }}
          .category
            i.fa.fa-tags
            span.category
              | {{ industries_link(project.industries) }}
      .edit
        a ng-click='open_head_edit()' 编辑
  .row.ng-cloak ng-show='head_edited'
    .small-12.columns
      form ng-submit='head_edit_submit()'
        .row
          .small-12.medium-6.columns
            label for='name' 项目名称
            input id='name' type='text' placeholder='如: 百度' ng-model="head_edit.name" ng-class= '{ error: head_edit.errors.name }'
            small.error.ng-cloak ng-show=' head_edit.errors.name ' {{ head_edit.errors.name }}
        .row
          .small-4.medium-2.columns
            .logo
              img ng-src=' {{ head_edit.logo_url }} '
        .row
          .small-8.medium-6.end.columns
            label for='logo' Logo( 建议 200x200 大小 )
            input id='logo' type='file' ng-file-select='upload_logo($files)'
            small.error.ng-cloak ng-show=' head_edit.logo_error ' {{ head_edit.logo_error }}
            input type='hidden' id='logo_id' ng-model=' head_edit.logo_id '
        .row
          .small-12.medium-8.columns
            label for='oneword' 一句话
            input id='oneword' type='text' placeholder='一句话说明, 将显示在项目副标题' ng-model='head_edit.oneword' ng-class= '{ error: head_edit.errors.oneword }'
            small.error.ng-cloak ng-show=' head_edit.errors.oneword' {{ head_edit.errors.oneword }}
        .row
          .small-12.medium-8.columns
            label for='link' 链接( 可选 )
            .row.collapse
              .small-3.medium-2.columns
                span.prefix http://
              .small-9.medium-10.columns
                input id='link' type='text' placeholder='项目网站链接' ng-model='head_edit.link' ng-class= '{ error: head_edit.errors.link }'
                small.error.ng-cloak ng-show=' errors.link' {{ head_edit.errors.link }}
        .row
          .small-12.medium-8.columns
            label for='industry' 所属行业
            a.select-industry-link ng-click='select_industry()' 点击选择
            ul.inline-list.select-industries
              .no-content ng-show='is_empty_industries()'
                | 选择的行业将会显示在这里
              li ng-repeat=' industry in head_edit.industries '
                .content
                  span
                    | {{ industry.name }}
                  span.revert ng-click='revert_select(industry)'
                    i.fa.fa-times
            small.error.ng-cloak ng-show=' head_edit.errors.industries' {{ head_edit.errors.industries }}
        .row
          .small-10.medium-4.columns
            label for='city' 城市
            input id='city' type='text' ng-model='head_edit.city' ng-class= '{ error: head_edit.errors.city}' typeahead="city.name for city in autocomplete_city($viewValue)" typeahead-loading="loadingCity" placeholder="请用中文输入"
            i ng-show="loadingCity" class="glyphicon glyphicon-refresh"
            small.error.ng-cloak ng-show=' head_edit.errors.city ' {{ head_edit.errors.city }}
        .row
          .small-12.medium-8.columns
            .control-actions
              button 提交
              a.back ng-click='head_edited = false' 取消
  .row.content
    .small-12.columns
      .basic-content
        h3.title 产品介绍
        p.description ng-hide='description_edited'
          | {{ project.description }}
        .edit
          a ng-click='open_description_edit()' 编辑
        .row ng-show= 'description_edited'
          .small-12.columns
            form ng-submit='update_description()'
              textarea ng-model='description_edit' placeholder='完整描述你的产品'
              .control-actions
                button 提交
                a.back ng-click='description_edited = false' 取消
      .row
        .small-12.columns
          h3.title 产品截图
          .image-content ng-hide='screenshot_edited'
            ul.image.clearing-thumbs#image-show.small-block-grid-4
              li ng-repeat="screenshot in project.screenshots"
                /*a ng-href="{{ screenshot.image_url }}"*/
                a
                  img ng-src="{{ screenshot.small_url }}"
          .edit
            a ng-click='open_screenshot_edit()' 编辑
          .image-content ng-show='screenshot_edited'
            ul.image-edit
              li ng-repeat="screenshot in screenshots_edit"
                img ng-src="{{ screenshot.thumb_url }}"
                span.name
                  | {{ screenshot.name }}
                span.operation
                  a ng-click='remove_screenshot($index)' 删除
            form ng-submit='update_screenshots()'
              input id='screenshot_file' type='file' ng-file-select='upload_screenshot($files)'
              .control-actions
                button 确认
                a.back ng-click='screenshot_edited = false' 取消
              
      .row
        .small-12.columns
          .team-content ng-controller='ProjectCreateTeamController' ng-init='init("#{@project.id}")'
            h3.title 团队情况
            .owner
              .row
                .small-12.columns
                  .person
                    .edit
                      a ng-click='open_owner_edited()' 编辑
                    .row
                      .small-4.medium-3.columns
                        img ng-src='{{ owner.avatar }}' alt='owner'
                        input id='owner-avatar' type='file' ng-file-select='upload_avatar($files)'
                      .small-8.medium-9.columns
                        div ng-hide=' owner_edited '
                          .name 
                            a ng-href='/users/{{ owner.user_id }}'
                              |{{ owner.name }}
                          .job-title
                            |{{ owner.title }}
                          .description
                            |{{ owner.description }}
                        form ng-show=' owner_edited ' ng-submit="update_owner()"
                          h6 编辑个人信息
                          .row
                            .small-12.medium-8.columns
                              label for='owner_name' 真实姓名
                              input id='owner_name' type='text' placeholder='真实姓名' ng-model = 'owner_edit.name'
                          .row
                            .small-12.medium-8.columns
                              label for='owner_title' 职位
                              input id='owner_title' type='text' placeholder='你在团队的职位' ng-model = 'owner_edit.title'
                          .row
                            .small-12.medium-8.columns
                              label for='owner_description' 更多详细信息
                              textarea id='owner_description' ng-model = 'owner_edit.description' placeholder=''
                                |{{owner_edit.description}}
                          .row
                            .small-12.medium-8.columns
                              p.alert
                                |{{ owner_edit_error }}
                              .control-actions
                                button.small 确认
                                a.cancel ng-click='cancel_owner_edit()' 取消
            .story
              .row
                .small-12.columns
                  h3.title 我们的故事
                  .edit
                    a ng-hide='team_edited' ng-click='open_team_story_edited()' 编辑
              .team-story-wrapper.description ng-hide= 'team_edited'
                |{{ team_story }}
              .team-story-edit ng-show = 'team_edited'
                form ng-submit='update_team_story()'
                  textarea placeholder='我的团队故事' ng-model='team_story_edit'
                  .control-actions
                    button.small 确认
                    a.cancel ng-click= 'cancel_team_edit()' 取消
            hr
            .members
              .row
                .small-12.columns
                  h3.title 我们的成员
                  .edit
                    a ng-click='members_edited = true' 添加
              ul.small-block-grid-1.medium-block-grid-2
                li ng-repeat=' member in members '
                  .person
                    .row ng-hide=' member.member_edited == member'
                      .small-4.medium-5.large-4.columns
                        img ng-src=' {{member.url}} ' alt='member'
                      .small-8.medium-7.large-8.columns
                        .name
                          a ng-href='/users/{{ member.user_id }}' {{ member.name }}
                        .job-title 
                          |{{member.title}}
                        .description 
                          |{{member.description}}
                        .edit
                          a ng-click='member.member_edited = member ' 编辑
                    .row ng-show='member.member_edited == member'
                      .small-12.columns
                        form ng-submit=' update_member(member) '
                          h6 编辑成员信息
                          input type='text' ng-model='member.title' placeholder='职位'
                          textarea ng-model='member.description' placeholder='详细描述'
                          p.alert
                            |{{ member_error }}
                          .control-actions
                            ul.button-group
                              li
                                button.small 确认
                              li
                                button.small ng-click='remove_member($event, member)' 移除
                              li
                                a.button.small ng-click='member.member_edited = false' 取消
              .row ng-show= 'members_edited'
                .small-12.columns
                  form
                    .row
                      .small-12.medium-6.columns.team_ul
                        script type='text/ng-template' id='autocompleteMember.html'
                          a ng-class='{disabled: match.model.joined }'
                            .row
                              .small-3.medium-3.large-2.columns
                                img ng-src= ' {{ match.model.avatar }} '
                              .small-9.medium-9.large-10.columns
                                h6.title
                                  |{{ match.model.name }} 
                                  .joined ng-show= 'match.model.joined' 已加入
                                  .unconfirmed ng-hide='match.model.confirmed' 邮件未确认
                        label for='invite_user' 添加或者邀请成员
                        input id='invite_user' type='text' placeholder='用户名或者邮箱' ng-model='invite_user' typeahead='member.name for member in autocomplete_member($viewValue)' typeahead-template-url='autocompleteMember.html' typeahead-on-select='add_member($item)'
                        .control-actions ng-hide='autocomplete_invite'
                          button.small ng-click= 'members_edited = false' 确认
                          a.cancel ng-click='members_edited = false' 取消
                  form ng-show='autocomplete_invite' ng-submit='autocomplete_invite_user()'
                    .row
                      .small-12.medium-6.columns
                        p.invite-tips 这个用户尚未注册, 你可以邀请加入团队, 我们会自动发送邀请邮件, 一旦注册, 将自动加入团队
                        label for='invite_name' 真实姓名
                        input type='text' id='invite_name' ng-model='autocomplete_invite_name'
                        .control-actions
                          button.small 发送
                          a.cancel ng-click='autocomplete_invite = false' 取消

              .control-actions ng-hide= 'members_edited'
                button.small ng-click= 'members_edited = true' 添加新的成员
      .row
        .small-12.columns
          .data-content
            h3.title 其他数据
            p.no-content 暂无数据
      .invest-content ng-controller='MoneyRequireController' ng-init= 'init(#{@project.id}, {})'
        .row
          .small-12.columns
            .edit
              = link_to '管理', admin_money_requires_path( project_id: @project.id )
        h3.title 投资情况
        .money-require ng-show='opened'
          moneyrequire require='opened' title='"当前轮次"'
        .row ng-hide= 'opened'
          .small-12.columns.no-invest-content
            p 当前无正在发起的投资
            = link_to '发起新的融资需求', admin_money_requires_path( project_id: @project.id ), class: 'button'
        .history ng-repeat='history in histories'
          moneyrequire require='history' title='"历史投资"'
        .row ng-show= 'is_histories_empty()'
          .small-12.columns
            h4.title 历史投资
            p.no-invest-content 无历史投资记录

